﻿<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body>

<?php
require_once './../class/DailyReport.inc';
require_once './../class/Employee.inc';
require './../class/MonthlyReport.inc';

$search_dt = $_POST ['search_dt'];
$mem_id = $_POST ['mem_id'];
$mem_nm = $_POST ['mem_nm'];
$attend_tp = $_POST ['attend_tp'];
$subs_amt = $_POST ['subs_amt'];
$subs_firm = $_POST ['subs_firm'];
$etc_amt_1 = $_POST ['etc_amt_1'];
$etc_amt_2 = $_POST ['etc_amt_2'];
$close_deduct = $_POST ['close_deduct'];
$note = $_POST ['note'];

$subs_amt = str_replace ( ',', '', $subs_amt );
$etc_amt_1 = str_replace ( ',', '', $etc_amt_1 );
$etc_amt_2 = str_replace ( ',', '', $etc_amt_2 );
$close_deduct = str_replace ( ',', '', $close_deduct );

$dReport = new DailyReport ();
$dReport->modifyDailyReport ( $search_dt, $mem_id, $attend_tp, 0, $subs_amt, $subs_firm, $etc_amt_1, $etc_amt_2, $close_deduct, $note );
/*
$empl = new Employee ();
$spDate = $empl->getSplyDate ( $mem_id, $search_dt );
$arr = array (
		0,
		0,
		0 
);
$i = 0;
$arr [$i] = strtok ( $spDate, "/" );

while ( $arr [$i] != "" ) {
	$i ++;
	$token = strtok ( "/" );
	$arr [$i] = $token;
}

$spDate = intval ( $arr [2] );
$curDate = intval ( date ( "d" ) );


if ($spDate == $curDate) {
	$monthlyReport = new MonthlyReport ();
	//$monthlyReport->createMonthlyReport ( $mem_id );
	$monthlyReport->createMonthlyReport ( '0',$mem_id, $search_dt);
	echo "<script type='text/javascript'>alert('" . $mem_id . "/" . $mem_nm . "님의 일일결산 정보가 저장 되었습니다. 월결산 화면으로 이동합니다.');location.replace('./../monthly_report.php?id=" . $mem_id . "&time=" . $search_dt . "');</script>";
} else {
	echo "<script type='text/javascript'>";
	echo "alert('" . $mem_id . "/" . $mem_nm . "님의 일일결산 정보가 저장 되었습니다.');";
	echo "history.back();";
	echo "</script>";
}
*/
echo "<script type='text/javascript'>";
echo "alert('" . $mem_id . "/" . $mem_nm . "님의 일일결산 정보가 저장 되었습니다.');";
echo "history.back();";
echo "</script>";
?>
</body>
</html>